import time
from data001.Tools.Tools import Tools
from data001.Base.Base import Base
from selenium.webdriver.common.by import By
class Page1(Base):
    # 点击登录
    login_loc = (By.CSS_SELECTOR, '.top-right > ul:nth-child(1) > li:nth-child(1) > a:nth-child(1)')
    def login(self):
        self.click(self.login_loc)
    # 输入账号
    name_loc = (By.XPATH, '//input[@name="username" and @class="regi-input"]')
    def username(self):
        self.send_keys(self.name_loc, '123455556666')
    # 输入密码
    password_loc = (By.XPATH, '//input[@type="password" or @name="password"]')
    def password(self):
        self.send_keys(self.password_loc, '123456')
    # 点击登录按钮
    click_button_loc = (By.XPATH, '//a[@class="finish-btn"]')
    def click_button(self):
        self.click(self.click_button_loc)


    def test_a3mall_login(self):
        Tools().Log()
        self.open_url('http://10.59.9.12:7001/')
        self.login()
        self.username()
        self.implicitly_wait()
        self.password()
        time.sleep(7)
        self.click_button()
        time.sleep(5)

